#include<bits/stdc++.h>
using namespace std;
string s1[1010],s2[1010];
int main(){
	freopen("replace.in","r",stdin);
	freopen("replace.out","w",stdout);
	int n,q;
	cin>>n>>q;
	for(int i=1;i<=n;i++){
		cin>>s1[i]>>s2[i];
	}
	srand(time(0));
	for(int i=1;i<=q;i++){
		cout<<rand()%n<<"\n";
	}
	return 0;
}

